; 2nd Tool Backup for Filament Runout
; This feature is currently under development

var msg1 = "UNDER DEVELOPMENT<br>"
var msg2 = "If Tool 0 runs out, switches to Tool 1.<br>"
var msg3 = "REQUIRES:<br>"
var msg4 = "- Same filament in both tools<br>"
var msg5 = "- Auto calibration done"
var message = var.msg1 ^ var.msg2 ^ var.msg3 ^ var.msg4 ^ var.msg5

M291 S4 R"2nd Tool Backup" P{var.message} K{"Enable","Disable"} F0

if input = 0
  ; Enable the feature
  set global.filamentBackup = true
  echo "Filament runout 2nd tool backup feature enabled."
else
  ; Disable the feature
  set global.filamentBackup = false
  echo "Filament runout 2nd tool backup feature disabled."

; Save the updated value to FilamentBackup.g for persistence
echo >"0:/sys/user/variables/FilamentBackup.g" "set global.filamentBackup = "^{global.filamentBackup}